package cn.itcast.n4_共享模型_管程;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * <p>
 * Test46_$$$$$_设计模式之顺序控制_wait_notify实现先打印1再打印2
 * </p>
 *
 * @author flyduck
 * @since 2024-11-01
 */
@Slf4j(topic = "c.Test47_$$$$$_设计模式之顺序控制_park_unpark实现先打印2再打印1")
public class Test47_$$$$$_设计模式之顺序控制_park_unpark实现先打印2再打印1 {


    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            LockSupport.park();
            log.debug("1");
        }, "t1");

        Thread t2 = new Thread(() -> {
            log.debug("2");
            LockSupport.unpark(t1);
        }, "t2");
        t1.start();
        t2.start();
    }
}
